<%--
 *  File:    EmployeeEdit.jsp
 *  @Author: Langerwang 
 *  Date:    2001/12/10
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<%
  //init param
  	Category cat = Category.getInstance("jsp.EmployeeEdit");  
  	String strModuleName = "OGM";
  	String privilegeCode = "10103,L102";
    String contextPath = request.getContextPath();
%>



<%
  	String dateFormat = (String)session.getAttribute("dateformat");
  	if(dateFormat==null)
  		dateFormat = "yyyy-MM-dd";
  //get curuserinfo
  
  HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");
  String strCurOrgName = (String)CurUserInfo.get("orgname");
  String strEmployeeId = (String)request.getParameter("employeeid");
  String strisnew=(String)request.getParameter("isnew");
  if (strisnew==null)
        strisnew="Y";
  boolean bReadOnly = false;
  boolean bIsEdit = false;
  if(strEmployeeId != null && strisnew.equalsIgnoreCase("N"))
  {
    bIsEdit = true;
    bReadOnly = true;
  }
  else
  {
    strEmployeeId = "";
  }
%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>

<html>
<head>
<title></title>
<PageFlow:CheckPageFlow pageName="employeeedit"/>
<%@ include file="/inc/InitEdit.inc" %>

<%
  HashMap employeeInfo = (HashMap)pageContext.getAttribute("emplinfo");
  if(employeeInfo == null)
  {
    employeeInfo = new HashMap();
  }   
  cat.debug("The employeeInfo is :" + employeeInfo); 
	String entryDate = OvalTools.dateToString(employeeInfo.get("entrydate"), dateFormat);
	String leaveDate = OvalTools.dateToString(employeeInfo.get("leavedate"), dateFormat);
  String birthDate = OvalTools.dateToString(employeeInfo.get("birthday"), dateFormat);
  HashMap defaultAddress = (HashMap)pageContext.getAttribute("homeaddress");
  if(defaultAddress == null)
  {
    defaultAddress = new HashMap();
  } 
  cat.debug("The defaultAddress is :" + defaultAddress);

  Vector addrcities = (Vector)pageContext.getAttribute("addrcities");
  if(addrcities == null)
    addrcities = new Vector();
  cat.debug("The addrcities is :" + addrcities);
  
  Vector addrreceivers = (Vector)pageContext.getAttribute("addrreceivers");
  if(addrreceivers == null)
    addrreceivers = new Vector();
  cat.debug("The addrreceivers is :" + addrreceivers);
 
  Vector addrlines = (Vector)pageContext.getAttribute("addrlines");
  if(addrlines == null)
    addrlines = new Vector();
  cat.debug("The addrlines is :" + addrlines);
  Integer nAddrId = (Integer)defaultAddress.get("addressid");
  boolean bAddrNew = false;
  if(nAddrId == null)
    bAddrNew = true;

  Integer nContentId0 = null;
  String strCityCN = new String("");
  Integer nContentId1 = null;
  String strCityEN = new String("");
  Integer nContentId2 = null;
  String strAddrLineCN = new String("");
  Integer nContentId3 = null;
  String strAddrLineEN = new String("");
  Integer nContentId4 = null;
  String strAddrReceiverEN = new String("");
  Integer nContentId5 = null;
  String strAddrReceiverCN = new String("");
  if(addrcities.size() == 2)
  for(int j = 0;j < addrcities.size();j++)
  {
    HashMap hashTemp = (HashMap)addrcities.elementAt(j);
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("cn"))
    {
      nContentId0 = (Integer)hashTemp.get("contentid");
      strCityCN = (String)hashTemp.get("content");
    }
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("en"))
    {
      nContentId1 = (Integer)hashTemp.get("contentid");
      strCityEN = (String)hashTemp.get("content");       
    }
  }  
  if(addrlines.size() == 2)  
  for(int k = 0;k < addrlines.size();k++)
  {
    HashMap hashTemp = (HashMap)addrlines.elementAt(k);
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("cn"))
    {
      nContentId2 = (Integer)hashTemp.get("contentid");
      strAddrLineCN = (String)hashTemp.get("content");
    }
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("en"))
    {
      nContentId3 = (Integer)hashTemp.get("contentid");
      strAddrLineEN = (String)hashTemp.get("content");       
    }
  }    
  
  if(addrreceivers.size() == 2)  
  for(int l = 0;l < addrreceivers.size();l++)
  {
    HashMap hashTemp = (HashMap)addrreceivers.elementAt(l);
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("cn"))
    {
      nContentId4 = (Integer)hashTemp.get("contentid");
      strAddrReceiverCN = (String)hashTemp.get("content");
    }
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("en"))
    {
      nContentId5 = (Integer)hashTemp.get("contentid");
      strAddrReceiverEN = (String)hashTemp.get("content");       
    }
  }    
    
  Vector alldepartmentSelect = (Vector)pageContext.getAttribute("alldepartment");
  if(alldepartmentSelect == null)
  {
    alldepartmentSelect = new Vector();
  } 
  cat.debug("The alldepartmentSelect is :" + alldepartmentSelect);
  Vector allgenderSelect = (Vector)pageContext.getAttribute("allgender");
  if(allgenderSelect == null)
  {
    allgenderSelect = new Vector();
  } 
  cat.debug("The allgenderSelect is :" + allgenderSelect);
  Vector alljobtitleSelect = (Vector)pageContext.getAttribute("alljobtitle");
  if(alljobtitleSelect == null)
  {
    alljobtitleSelect = new Vector();
  } 
  cat.debug("The alljobtitleSelect is :" + alljobtitleSelect);
  Vector alleducationlevelSelect = (Vector)pageContext.getAttribute("alleducationlevel");
  if(alleducationlevelSelect == null)
  {
    alleducationlevelSelect = new Vector();
  } 
  cat.debug("The alleducationlevelSelect is :" + alleducationlevelSelect);
  Vector allmarriagestatusSelect = (Vector)pageContext.getAttribute("allmarriagestatus");
  if(allmarriagestatusSelect == null)
  {
    allmarriagestatusSelect = new Vector();
  } 
  cat.debug("The allmarriagestatusSelect is :" + allmarriagestatusSelect);
  Vector allofficeaddrSelect = (Vector)pageContext.getAttribute("allofficeaddr");
  if(allofficeaddrSelect == null)
  {
    allofficeaddrSelect = new Vector();
  } 
  cat.debug("The allofficeaddrSelect is :" + allofficeaddrSelect);  
  Vector allstatusSelect = (Vector)pageContext.getAttribute("allstatus");
  if(allstatusSelect == null)
  {
    allstatusSelect = new Vector();
  }
  Vector allregionSelect = (Vector)pageContext.getAttribute("allregion");
  Vector allcountrySelect = (Vector)pageContext.getAttribute("allcountry");
  if(allcountrySelect == null)
  {
    allcountrySelect = new Vector();
  } 
  cat.debug("The allcountrySelect is :" + allcountrySelect);
  if(allregionSelect == null)
  {
    allregionSelect = new Vector();
  } 
  cat.debug("The allregionSelect is :" + allregionSelect);        
%>
<%
 if(alldepartmentSelect.size() == 0){
%>
<script>
alert("<%= message.getMessageDesc("NO_DEPT_TO_ADD_EMPL") %>");
//history.back();
</script>

<%
  }
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<script language="JavaScript" src="../../js/ScriptLib.js"></script>
<%@ include file="/inc/NewCalendar.inc" %>
<%
    HashMap userinfo=(HashMap)session.getAttribute("userinfo");
    Integer booksetid=null,neworgid=null;
    if(userinfo!=null)
    booksetid=(Integer)userinfo.get("booksetid");
    neworgid=(Integer)userinfo.get("orgid");

%>
<script language="JavaScript">
var needcheckaddress = false;
function changeAddress()
{
  if(frm.defaultaddess.value==true)
    return;
  if(document.frm.countrycode.value == "-1")
  {
    document.all.item("c0").className = "td-text";
    document.all.item("c1").className = "td-text";
    document.all.item("cn").className = "td-text";
    document.all.item("rn").className = "td-text";
    document.all.item("zc").className = "td-text";
   
    document.frm.regioncode.value = "";
    document.frm.regionname.value = "";
    document.frm.zipcode.value = "";

    document.frm.countrycode.isnull= "Y";
    document.frm.regioncode.isnull= "Y";
    document.frm.regionname.isnull = "Y";
    document.frm.ac0.command="cannull";
    document.frm.zipcode.isnull= "Y";
    needcheckaddress = false;
  }else{
    document.all.item("c0").className = "need";
    document.all.item("c1").className = "td-text";
    document.all.item("cn").className = "need";
    document.all.item("rn").className = "need";
    document.all.item("zc").className = "need";

    document.frm.countrycode.isnull = "N";
    document.frm.regioncode.isnull = "N";
    document.frm.regionname.isnull = "N";
    document.frm.ac0.command="notnull";
    document.frm.zipcode.isnull = "N";
    needcheckaddress = true;
  }
}
function page_changecountry()
{
	document.frm.regioncode.value = "";
  document.frm.regionname.value = "";
  <%--[SCRIPT]  document.frm.ac0.value = "";  [SCRIPT]--%>
  document.frm.zipcode.value = "";
  <%--[SCRIPT]  document.frm.al10.value ="";  [SCRIPT]--%>
  for(var i=0;i<Number(frm.numrows.value);i++)
  {
    var obj1=eval("frm.ac"+i);
    var obj2=eval("frm.al1"+i);
    obj1.value="";
    obj2.value="";
   <%--[SCRIPT]   alert("city name :"+obj1.name+"\tvalue :"+obj1.value+"\naddress name :"+obj2.name+"\tvalue :"+obj2.value);  [SCRIPT]--%>
  }
  frm.defaultaddess.value=false;
  changeAddress();
}
function page_setRegion(code,name)
{
  <%--[SCRIPT]  alert(id);  [SCRIPT]--%>
  <%--[SCRIPT]  alert(name);  [SCRIPT]--%>
  document.frm.regioncode.value = code;
  document.frm.regionname.value = name;
  var remote = window.open("","newwindow");
  if (remote != null)
    remote.close();
}

function selectRegion()
{
  if(document.frm.countrycode.value != "-1")
  {
    url = "RegionSelect.jsp?<%= OvalTools.randomURL() %>&countrycode=" + document.frm.countrycode.value + "&languagecode=" + "<%= strLanguageCode %>"
    popup(url,'newwindow', 'height=250, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no');
  }
  else
  {
    alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_CountryName",false)) %>");
    return;
  }
}

function checkEmployeeInfo(form)
{
  if(form.employeename.value.length < 0 || form.employeename.value.length > 20)
  {
    alert("Employeename Name is invalid!");
    return false;
  }  
  <%--[SCRIPT]  if(!emailCheck(form.email.value,false))  [SCRIPT]--%>
  <%--[SCRIPT]  {  [SCRIPT]--%>
    <%--[SCRIPT]  return false;    [SCRIPT]--%>
  <%--[SCRIPT]  }  [SCRIPT]--%>
  if(!isEmpty(form.email.value) && Trim(form.email.value)!=""  ) 
  {
      if(!emailCheck(form.email.value,false))
      {
        alert("<%= message.getMessageDesc("ILLEGAL_FORMAT", "E-mail") %>");
        return false;        
      }
  }  	
  return true;
}
function initContentValue(form)
{
  if(isEmpty(form.content0.value))
    form.content0.value = form.content1.value;
  if(isEmpty(form.content1.value))
    form.content1.value = form.content0.value;
  if(isEmpty(form.content2.value))
    form.content2.value = form.content3.value;
  if(isEmpty(form.content3.value))
    form.content3.value = form.content2.value;     
}

function page_done()
{
  changeAddress();
  if(!isEmpty(document.frm.leavedate0.value) && !isEmpty(document.frm.entrydate0.value))
  {
    var dateLeave=dateCheck(document.frm.leavedate0.value, 'yyyy-MM-dd', '<%=JspHelper.filterNull( dateFormat )%>');
    var dateEnter=dateCheck(document.frm.entrydate0.value, 'yyyy-MM-dd', '<%=JspHelper.filterNull( dateFormat )%>');
    if(dateLeave<dateEnter)
    {
      alert('<%=message.getMessageDesc("CAN_NOT_LATE_THAN",label.getLabelName("L_EntryDate",false),label.getLabelName("L_LeaveDate",false))%>');
      return;
    }
  }
  var leavedate = document.frm.leavedate.value;
  if(leavedate.length>0)
    document.frm.status.value=28;

<%--[SCRIPT]    document.frm.content4.value = document.frm.employeename.value;  [SCRIPT]--%>
<%--[SCRIPT]   document.frm.content5.value = document.frm.firstname.value + " " + document.frm.lastname.value;  [SCRIPT]--%>
 
  if(!checkEmployeeInfo(document.frm))
    return;

  if(!checkNull(document.frm))
  		return;  
  if(!checkForm(document.frm))
  		return;  		
  var addrvalue=document.frm.officeaddressid.value;		
  if(addrvalue=="-1" || addrvalue=="" || addrvalue==" ")
  {
    alert('<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_OfficeAddress",false) )%>');
    return;
  }
  

<%-- if (!bIsEdit)
	{--%>
		MLCSTransform(frm);
<%--	}else{--%>
		emptyToNull(frm);
	<%--}--%>


  	<%--[SCRIPT]  document.frm.birthday.value = " ";  [SCRIPT]--%>
  	if(document.frm.birthday0.value==" ")
  		document.frm.birthday.value = " ";
  	if(document.frm.entrydate0.value==" ")
  		document.frm.entrydate.value = " ";
  	if(document.frm.leavedate0.value==" ")
  		document.frm.leavedate.value = " ";	
  
  
  
  selectCheck(document.frm);
  
  if( isEmpty(document.frm.parentemployeeid.value))
    document.frm.parentemployeeid.value = " ";
    
  document.frm.actionname.value = "done";
  isRunning = true;
  document.frm.submit();
}

function leaveDateChanged()
{
  document.frm.leavedate.value=dateCheck(document.frm.leavedate0.value, 'yyyy-MM-dd', '<%=JspHelper.filterNull( dateFormat )%>');
  if(document.frm.leavedate.value<0)
  {
    alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE", label.getLabelName("L_LeaveDate",false))%>');
    document.frm.leavedate0.focus();
  }

}
function poporg()
{
  window.open("OrgSelect.jsp?<%= OvalTools.randomURL() %>&selectoption=owner&languagecode=<%= strLanguageCode %>", "newwindow", "height=250, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
}
function page_setOrg(id,name,code)
{
  document.frm.orgid.value = id;
  document.frm.orgname.value = name;
  document.frm.orgcode.value = code;

  document.frm.action = "EmployeeEdit.jsp?<%= OvalTools.randomURL() %>";
  document.frm.target = "_self";
  isRunning = true;				//Do not forget this line
  document.frm.submit();
}

function page_orgchange()
{
  document.frm.action = "EmployeeEdit.jsp?<%= OvalTools.randomURL() %>";
  document.frm.target = "_self";
  isRunning = true;				//Do not forget this line
  document.frm.submit();
}


function page_setGLAccount(glaccountid,accountname,accountcode)
{
     frm.glaccountid.value=  glaccountid;
     frm. accountname.value= accountname;
     frm. accountcode.value= accountcode;

}
function page_getGLAccountname()
{

     frm.glaccountid.value="";
     frm.accountname.value="";
     if(frm.accountcode.value!="")
     {
         <%if(neworgid!=null){%> frm.neworgid.value=<%=JspHelper.filterNull(neworgid)%>;<%}%>
         <%if(booksetid!=null){%> frm.booksetid.value=<%=JspHelper.filterNull(booksetid)%>;<%}%>
         frm.schema.value="ovglaccountsummary";
         frm.qlname.value="selectforreload";
         page_handleRequest('<%=contextPath%>',frm);
     }
}
function page_handleResponse()
{
    frm.glaccountid.value = getResponseData("glaccountid");
    frm.accountname.value = getResponseData("accountname");
}

function parentemppop()
{
                                                                       
  window.open("EmployeeSelect.jsp?<%= OvalTools.randomURL() %>&selectoption=owner&languagecode=<%= strLanguageCode %>&employeeid="+document.frm.employeeid.value, "newwindow", "height=250, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
}
function page_setEmployee(id,name,code)
{ 
  document.frm.parentemployeeid.value = id;
  document.frm.parentemployeecode.value = name;
  document.frm.parentemployeename.value = code;
  document.frm.action = "EmployeeEdit.jsp?<%= OvalTools.randomURL() %>";
  document.frm.target = "_self";
  isRunning = true;				//Do not forget this line
  document.frm.submit();
}
function  reload_parentemp(){
 document.frm.parentemployeeid.value = "";
 document.frm.parentemployeename.value = "";
 if( isEmpty(document.frm.parentemployeecode.value))
   return;
 var  datahandler = new  DataHandler() ;
 datahandler.add_params("orgid" , document.frm.orgid.value,"Integer");
 datahandler.add_params("employeeid" , document.frm.employeeid.value,"Integer");
 datahandler.add_params("parentemployeecode" , document.frm.parentemployeecode.value,"String") ;
 datahandler.getResult("employeeid","document.frm.parentemployeeid"); 
 datahandler.getResult("employeename","document.frm.parentemployeename"); 
 datahandler.add_job("getparentemp") ;
 datahandler.runDataHandler ();
}	
</script>
<iframe name="reloadHandler" style="display:none" ></iframe>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td class="summary_top"></td>
  </tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0">
  <form name="frm" method="post" action="../../Dispatcher">
        	<input type=hidden name=numrows value='<%= ConstantProp.multiLangNumber %>'>

	   <input type="hidden" name="pagename" value="employeeedit">
       <input type="hidden" name="actionname">
       <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">
       <input type="hidden" name="employeeid" value="<%=JspHelper.filterNull( employeeInfo.get("employeeid") )%>">
        <input type="hidden" name="defaultaddess" value="<%=JspHelper.filterNull( !defaultAddress.isEmpty() )%>"/>
       <input type="hidden" name="addressid" value="<%=JspHelper.filterNull( nAddrId )%>"> 
       <input type="hidden" name="entityid0" value="<%=JspHelper.filterNull( nAddrId )%>"> 
       <input type="hidden" name="entityid1" value="<%=JspHelper.filterNull( nAddrId )%>"> 
       <input type="hidden" name="entityid2" value="<%=JspHelper.filterNull( nAddrId )%>"> 
       <input type="hidden" name="entityid3" value="<%=JspHelper.filterNull( nAddrId )%>"> 
       <input type="hidden" name="entityid4" value="<%=JspHelper.filterNull( nAddrId )%>"> 
       <input type="hidden" name="entityid5" value="<%=JspHelper.filterNull( nAddrId )%>"> 
    
       

       <input type="hidden" name="isprimary" value="<%=JspHelper.filterNull( new String("Y") )%>"> 
       <input type="hidden" name="addressroletype" value="<%=JspHelper.filterNull( new Integer(11) )%>"> 
       <input type="hidden" name="addressname" value="<%=JspHelper.filterNull( new String("HomeAddress") )%>"> 
       <input type="hidden" name="orgid" value="<%=JspHelper.filterNull( request.getParameter("orgid") )%>">
       <input type="hidden" name="isnew" value="<%=JspHelper.filterNull( request.getParameter("isnew") )%>">

       <input type="hidden" name="isprimary" value="<%=JspHelper.filterNull( new String("Y") )%>">
       <input type="hidden" name="addressroletype" value="<%=JspHelper.filterNull( new Integer(11) )%>"> 

       <input type="hidden" name="datelastupdated" value="<%=JspHelper.filterNull( new java.sql.Date(new java.util.Date().getTime()) )%>">                                     
       <%--input type="hidden" name="numrows" value="<%=JspHelper.filterNull( new Integer(6) )%>"--%> 

       <input type="hidden" name="isedit" value="<%=JspHelper.filterNull( bIsEdit )%>"> 
       <input type="hidden" name="addrnew" value="<%=JspHelper.filterNull( bAddrNew )%>"> 
       <input  type="hidden" name="isbottom" value="1">
       <input type="hidden" name="addresstype" value="<%=JspHelper.filterNull( "e" )%>">
       <input type="hidden" name="neworgid">
       <input type="hidden" name="booksetid">
       <input type="hidden" name="schema">
       <input type="hidden" name="qlname">
  <tr>
    <td valign="top">
        <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="3">
          <tr>
            <td colspan="4" class="deepblue-left"> <img src="../../images/<%= strLanguageCode %>/quote.gif">
              <%= label.getLabelName("L_BasicInfo") + label.getLabelName("L_Colon") %> </td>
          </tr>
          <tr>
            <td width="106" class="need"><%= label.getLabelName("L_OwnerOrg") + label.getLabelName("L_Colon") %> </td>
            <td >
               <input type="text" name="orgcode" value='<oval:write name="orginfo" property="orgcode"/>' onchange="javascript:page_orgchange();">
               <a onclick="poporg()"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
               <input type="text" name="orgname" readonly="true" value='<oval:write name="orginfo" property="orgname"/>'>
            </td>
           <td class="td-text" width="106"><%= label.getLabelName("L_ParentEmp") + label.getLabelName("L_Colon") %> </td>
          <td colspan="3">
             <custom:text name="emplinfo" property="parentemployeecode" onchange="javascript:reload_parentemp();"/>
             <a onclick='javascript:parentemppop();'><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
             &nbsp;
             <custom:text name="emplinfo" property="parentemployeename" readonly="true"/>
             <custom:hidden name="emplinfo" property="parentemployeeid" />
          </td>
          </tr>
          <tr>
            <td width="106" class="need"><%= label.getLabelName("L_EmployeeCode") + label.getLabelName("L_Colon") %> </td>
            <td >
            	<% String s1 = message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_EmployeeCode",false)); %> 
              <oval:text name="emplinfo" property="employeecode" readonly="<%= bReadOnly %>" size="20" isnull="N" label="<%= s1 %>"/>
            </td>
            <td class="need" width="106" ><%= label.getLabelName("L_DefaultDeptName") + label.getLabelName("L_Colon") %> </td>
            <td >
               <oval:select optionsName="alldepartment" optionValueKey="deptid" optionInnerTextKey="deptname"  name="emplinfo" property="deptid" />
            </td>
          </tr>
          <tr>
            <td width="106" class="need"><%= label.getLabelName("L_EmployeeName") + label.getLabelName("L_Colon") %> </td>
            <td > 
            	<% String s2 = message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_EmployeeName",false)); %> 
              <oval:text name="emplinfo" property="employeename" size="20" isnull="N" label="<%= s2 %>"/>
            </td>
            <td width="106" class="td-text"> <%= label.getLabelName("L_EmployeeNameEN") + label.getLabelName("L_Colon") %></td>
            <td width="228" > 
              <oval:text name="emplinfo" property="firstname" size="8" />
              <oval:text name="emplinfo" property="lastname" size="8" />
            </td>
          </tr>
          <tr> 
            <td class="need" width="106"><%= label.getLabelName("L_GenderName") + label.getLabelName("L_Colon") %></td>
            <td > 
               <oval:select optionsName="allgender" optionValueKey="value" optionInnerTextKey="valuename" name="emplinfo" property="gender"/>
            </td>
            <td class="td-text" width="106" ><%= label.getLabelName("L_TitleName") + label.getLabelName("L_Colon") %></td>
            <td width="228" > 
               <oval:select optionsName="alljobtitle" optionValueKey="value" optionInnerTextKey="valuename" name="emplinfo" property="jobtitlecode"/>
            </td>
          </tr>
          <tr> 
            <td class="td-text" width="106"><%= label.getLabelName("L_EducationalLevel") + label.getLabelName("L_Colon") %></td>
            <td > 
              <oval:select optionsName="alleducationlevel" optionValueKey="value" optionInnerTextKey="valuename" name="emplinfo" property="educationlevelcode"/>
            </td>
            <td class="need" width="106" ><%= label.getLabelName("L_MarriageStatusName") + label.getLabelName("L_Colon") %></td>
            <td width="228" > 
               <oval:select optionsName="allmarriagestatus" optionValueKey="value" optionInnerTextKey="valuename" name="emplinfo" property="marriagestatus"/>
            </td>
          </tr>
          <tr> 
            <td class="td-text" width="106"><%= label.getLabelName("L_Birthday") + label.getLabelName("L_Colon") %></td>
            <td > 
              	<input type="text" name="birthday0" value="<%=JspHelper.filterNull( birthDate )%>" onblur="birthday.value=dateCheck(birthday0.value, 'yyyy-MM-dd', '<%=JspHelper.filterNull( dateFormat )%>');if(birthday.value<0){alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE", label.getLabelName("L_Birthday",false))%>' + '(<%=JspHelper.filterNull( dateFormat )%>)');birthday0.focus();}">&nbsp;<a onclick="javascript:c.show(this,'frm.birthday0','<%=JspHelper.filterNull( dateFormat )%>')"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
              	<input type="hidden" name="birthday" command="emptytonull">
            </td>
            <td class="td-text" width="106"><%= label.getLabelName("L_EntryDate") + label.getLabelName("L_Colon") %></td>
            <td width="228" >
            	<input type="text" name="entrydate0" value="<%=JspHelper.filterNull( entryDate )%>" onblur="entrydate.value=dateCheck(entrydate0.value, 'yyyy-MM-dd', '<%=JspHelper.filterNull( dateFormat )%>');if(entrydate.value<0){alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE", label.getLabelName("L_EntryDate",false))%>' + '(<%=JspHelper.filterNull( dateFormat )%>)');entrydate0.focus();}">&nbsp;<a onclick="javascript:c.show(this,'frm.entrydate0','<%=JspHelper.filterNull( dateFormat )%>')"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
              	<input type="hidden" name="entrydate" command="emptytonull">
            </td>
          </tr>
          <tr> 
            <td class="td-text" width="106"><%= label.getLabelName("L_IDNumber") + label.getLabelName("L_Colon") %></td>
            <td > 
              <oval:text name="emplinfo" property="idcardnumber" size="20" />
            </td>
            <td class="td-text" width="106"><%= label.getLabelName("L_PrivateBankAccount") + label.getLabelName("L_Colon") %></td>
            <td width="228" > 
              <oval:text name="emplinfo" property="privatebankaccount" size="20" />
           </td>
          </tr>
          <tr> 
            <td class="need" width="106"><%= label.getLabelName("L_OfficeAddress") + label.getLabelName("L_Colon") %></td>
            <td > 
            	<% String sa = message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_OfficeAddress",false)); %>             
               <oval:select isnull="N" label="<%= sa %>"  optionsName="allofficeaddr" optionValueKey="addressid" optionInnerTextKey="addressname" name="emplinfo" property="officeaddressid" defaultValue="--------"/>
            </td>
            <td class="td-text" width="106"><%= label.getLabelName("L_LeaveDate") + label.getLabelName("L_Colon") %></td>
            <td width="228" >
              <input type="text" name="leavedate0" value="<%=JspHelper.filterNull( leaveDate )%>" onblur="javascript:leaveDateChanged()">&nbsp;<a onclick="javascript:c.show(this,'frm.leavedate0','<%=JspHelper.filterNull( dateFormat )%>')"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
              	<input type="hidden" name="leavedate" command="emptytonull">
            </td>
          </tr>
          <tr> 
            <td class="need" width="106"><%= label.getLabelName("L_StatusName") + label.getLabelName("L_Colon") %></td>
            <td >
               <oval:select optionsName="allstatus" optionValueKey="statuscode" optionInnerTextKey="statusname" name="emplinfo" property="status"/>
            </td>
            <td class="td-text" width="106"><%= label.getLabelName("L_GLAccount") + label.getLabelName("L_Colon") %></td>
            <td>
               <oval:text name="glhash" property="accountcode"  size="10" onchange='page_getGLAccountname()'/>
               <a onclick='window.open("../../gl/GLADebit.jsp?<%= OvalTools.randomURL() %>&isbottom=1", "newwindow", "height=400, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no")'>
               <custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
               <oval:text name="glhash" property="accountname"  size="20" readonly="true" />
               <oval:hidden name="emplinfo" property="glaccountid" />
            </td>
          </tr>
          
           <%if(!bIsEdit){%>
          <tr>
            <td class="td-text"> <%=label.getLabelName("L_ContactRoleType")+label.getLabelName("L_Colon")%> </td>
            <td colspan="3" > <custom:selectdic property="contactroletype" dictType="ContactRoleType" defaultValue="------" defaultValueCost="" value="2"/> </td>
          </tr>
          <%}%>         
          
          <tr>
            <td colspan="4" class="deepblue-left"><img src="../../images/<%= strLanguageCode %>/quote.gif">
              <%= label.getLabelName("L_ContactMethod") + label.getLabelName("L_Colon") %></td>
          </tr>
          <tr> 
            <td class="need" width="106"><%= label.getLabelName("L_Telephone") + label.getLabelName("L_Colon") %></td>
            <td > 
            	<% String s3 = message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_Telephone",false)); %> 
              <oval:text name="emplinfo" property="officephone" size="20" isnull="N" label="<%=  s3%>"/>
            </td>
            <td class="td-text" width="106"><%= label.getLabelName("L_Fax") + label.getLabelName("L_Colon") %></td>
            <td width="228" > 
              <oval:text name="emplinfo" property="faxnumber" size="20" />
            </td>
          </tr>
          <tr> 
            <td class="td-text" width="106"><%= label.getLabelName("L_HomePhone") + label.getLabelName("L_Colon") %></td>
            <td > 
              <oval:text name="emplinfo" property="homephone" size="20" />
            </td>
            <td class="td-text" width="106"><%= label.getLabelName("L_MobilePhone") + label.getLabelName("L_Colon") %></td>
            <td width="228" > 
              <oval:text name="emplinfo" property="mobilephone" size="20" />
            </td>
          </tr>
          <tr> 
            <td class="td-text" width="106">E-mail<%= label.getLabelName("L_Colon") %></td>
            <td > 
              <oval:text name="emplinfo" property="email" size="20" />
            </td>
            <td class="td-text" width="106" ><%= label.getLabelName("L_BPNumber") + label.getLabelName("L_Colon") %></td>
            <td > 
              <oval:text name="emplinfo" property="bpnumber" size="20" />
            </td>
          </tr>
          <tr> 
            <td colspan="4" class="deepblue-left"><img src="../../images/<%= strLanguageCode %>/quote.gif"> 
            <%= label.getLabelName("L_HomeAddress") + label.getLabelName("L_Colon") %></td>
          </tr>
          <tr> 
            <td class="need" id="cn"><%= label.getLabelName("L_CountryName") + label.getLabelName("L_Colon") %></td>
            <td > 
           	<% String s223 = message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_RegionName",false));
           	if(defaultAddress.get("countrycode")==null){
           	 %> 
               <oval:select optionsName="allcountry" optionValueKey="countrycode" optionInnerTextKey="countryname" isnull="N" label="<%= s223 %>" name="homeaddress" property="countrycode" defaultValue="----------" onchange="javascript:page_changecountry()"/>
            <%}else{%>
              <oval:select optionsName="allcountry" optionValueKey="countrycode" optionInnerTextKey="countryname" isnull="N" label="<%= s223 %>" name="homeaddress" property="countrycode" onchange="javascript:page_changecountry()"/>
            
            <%}%>
            </td>
            <td width="106" id="rn" class="need"><%= label.getLabelName("L_RegionName") + label.getLabelName("L_Colon") %></td>
            <td width="228"> 
            	<% String s4 = message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_RegionName",false)); %> 
               <oval:hidden name="homeaddress" property="regioncode" size="20" isnull="N" label="<%= s4 %>" />    
               <oval:text name="homeaddress" property="regionname" readonly="true" size="20" isnull="N" label="<%= s4 %>"/>&nbsp;<a onclick="selectRegion()"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a> 
           </td>
          </tr>
          <%
            String strIsNeedCN = "td-text";
            String strIsNeedEN = "td-text";
            String strNullCN = "Y";
            String strNullEN = "N";            
            if(strLanguageCode.equalsIgnoreCase("cn"))
            {
              strIsNeedCN = "need";
              strNullCN = "N";
            }
            if(strLanguageCode.equalsIgnoreCase("en"))
            {
              strIsNeedEN = "need";
              strNullEN = "N";
            }            
          %>
  
          <tr> 
            <td class="need" id="c0" width="104"><%= label.getLabelName("L_CityName") + label.getLabelName("L_Colon") %></td>
            	
				 <td colspan="3"> 
															<custom:text name="homeaddress" property="cityname" size="20" module="MD" label="L_City" needMLC="true" isFirstMLC="true" multiLangType="ac" entityId="addressid" contentId="addresslangid" colIndex="0"/>
															<a onclick='popup("../../common/Lang.jsp?<%= OvalTools.randomURL() %>&form=frm&module=MD&mlctype=L_City&nativelanguage="+c0.className+"&schema=ovaddresslang&qlname=selectbyaddressid&entityid=<custom:write name="homeaddress" property="addressid"/>&entitytype=ac&contentid=addresslangid&colindex=0", "newwindow", "height=250, width=320,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no");'><custom:button type="3" label="L_Ln" imgsrc="ln.gif" border="0"/></a>
		                        </td>
          </tr>
          <tr> 
            <td width="106" id="zc" class="need"><%= label.getLabelName("L_ZipCode") + label.getLabelName("L_Colon") %></td>
            <td colspan="3" >
            	<% String s7 = message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_ZipCode",false)); %>  
               <oval:text name="homeaddress" property="zipcode" size="20" isnull="N" label="<%=   s7 %>"/>
            </td>
          </tr>
          <tr> 
            <td class="td-text" id="c1" width="104"><%= label.getLabelName("L_AddressLine1") + label.getLabelName("L_Colon") %></td>
            	
				  <td colspan="3"> 
															<custom:text name="homeaddress" property="addressline1" size="77" command="cannull" module="MD" label="L_Address" needMLC="true" multiLangType="al1" entityId="addressid" contentId="addresslangid" colIndex="0"/>
															<a onclick='popup("../../common/Lang.jsp?<%= OvalTools.randomURL() %>&form=frm&module=MD&mlctype=L_Address&nativelanguage=&schema=ovaddresslang&qlname=selectbyaddressid&entityid=<custom:write name="homeaddress" property="addressid"/>&entitytype=al1&contentid=addresslangid&colindex=0", "newwindow", "height=250, width=320,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no");'><custom:button type="3" label="L_Ln" imgsrc="ln.gif" border="0"/></a>
		                        </td>
        </table>
      </td>
  </tr>
  <tr>
    <td class="summary_top"></td>
  </tr>
  <tr> 
    <td height="49" class="td_center"> 
      <a onclick="page_done()"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a>
    </td>
  </tr>
  </form>
</table>
<script>
  changeAddress();
</script>

</body>
</html>


